package pari;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import externaldata.theoricaltimefile.TheoricalTrainData;
import user.User;

@Entity
@Table(name="Pari")
public class Pari implements Serializable{

	@Id
	@Column(name="id_pari")
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int id_pari;

	@ManyToOne
	public TheoricalTrainData id_train;
	
	@ManyToOne
	public User user;

	@Column(name="montant")
	public int montant;

	@Column(name="heureFait")
	public Date heureFait;

	@Column(name="etatPari")
	public int etatPari;

	@Column(name="retardEnMinutes")
	public int retardEnMinutes;

	@Column(name="gainPossible")
	public int gainPossible;

	public Pari() {
		super();
	}

	public Pari(TheoricalTrainData id_train, int montant, Date heure_fait,
			int etatPari, int retardEnMinutes) {
		super();
		this.id_train = id_train;
		this.montant = montant;
		this.heureFait = heure_fait;
		this.etatPari = etatPari;
		this.retardEnMinutes = retardEnMinutes;
		this.user = null;
	}

	public int getId_pari() {
		return id_pari;
	}

	public void setId_pari(int id_pari) {
		this.id_pari = id_pari;
	}

	public TheoricalTrainData getId_train() {
		return id_train;
	}

	public void setId_train(TheoricalTrainData id_train) {
		this.id_train = id_train;
	}

	public int getMontant() {
		return montant;
	}

	public void setMontant(int montant) {
		this.montant = montant;
	}

	public Date getHeureFait() {
		return heureFait;
	}

	public void setHeureFait(Date heureFait) {
		this.heureFait = heureFait;
	}

	public int getEtatPari() {
		return etatPari;
	}

	public void setEtatPari(int etatPari) {
		this.etatPari = etatPari;
	}

	public int getRetardEnMinutes() {
		return retardEnMinutes;
	}

	public void setRetardEnMinutes(int retardEnMinutes) {
		this.retardEnMinutes = retardEnMinutes;
	}

	public int getGainPossible() {
		return gainPossible;
	}

	public void setGainPossible(int gainPossible) {
		this.gainPossible = gainPossible;
	}
	
	

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Override
	public boolean equals(Object o){
		if(o instanceof Pari && ((Pari)o).id_pari == this.id_pari)
			return true;
		return false;
	}
	
	
}
